package com.mc.clt.task;

import com.mc.clt.domain.CltTask;
import com.mc.clt.service.ICltTaskService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.logging.Logger;


@Component("cltTask")
public class CltExpireTask {

    @Autowired
    private ICltTaskService cltTaskService;
    private static final org.slf4j.Logger log = LoggerFactory.getLogger(CltExpireTask.class);

    /**
     * 定时任务 --- 采集任务到期禁用
     */

    public void disableCltTask(){
        log.info("采集任务到期禁用开始");
        List<CltTask> list = cltTaskService.selectCltTaskListByExpire();
        for(CltTask cltTask : list){
            if(cltTask.getState().equals("0")){
                log.info("采集任务到期禁用采集："+cltTask.getTaskName());
                cltTaskService.deleteCltTaskById(cltTask.getId());
            }
        }
        log.info("采集任务到期禁用结束");
    }
}
